var t = require;
var e = module;
var o = exports;
var a,
    i =
        (this && this.__extends) ||
        ((a = function (t, e) {
            return (a =
                Object.setPrototypeOf ||
                ({ __proto__: [] } instanceof Array &&
                    function (t, e) {
                        t.__proto__ = e;
                    }) ||
                function (t, e) {
                    for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
                })(t, e);
        }),
            function (t, e) {
                a(t, e);
                function o() {
                    this.constructor = t;
                }
                t.prototype = null === e ? Object.create(e) : ((o.prototype = e.prototype), new o());
            }),
    n =
        (this && this.__decorate) ||
        function (t, e, o, a) {
            var i,
                n = arguments.length,
                r = n < 3 ? e : null === a ? (a = Object.getOwnPropertyDescriptor(e, o)) : a;
            if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(t, e, o, a);
            else
                for (var s = t.length - 1; s >= 0; s--)
                    (i = t[s]) && (r = (n < 3 ? i(r) : n > 3 ? i(e, o, r) : i(e, o)) || r);
            return n > 3 && r && Object.defineProperty(e, o, r), r;
        };
Object.defineProperty(o, "__esModule", { value: !0 });
var r = t("UIBase"),
    s = t("UIConfig"),
    c = t("UIManager"),
    p = t("GameEm"),
    l = cc._decorator,
    d = l.ccclass,
    u =
        (l.property,
            l.menu,
            (function (t) {
                i(e, t);
                function e() {
                    var e = (null !== t && t.apply(this, arguments)) || this;
                    e.addCost = "";
                    return e;
                }
                e.prototype.onShowEnd = function () {
                    this.updateView();
                };
                e.prototype.updateView = function () {
                    var t = CacheDataManager.getAllAddCost(),
                        e = CacheDataManager.getLevelChapterMul(GameDataValue.getLastLv()),
                        o = this.ui_data.offTime || 0,
                        a = 10800 * CacheDataManager.getLvUpgradeValueData(p.UpgradeData.offLineAddValue),
                        i = Math.floor(Math.min(o, a)),
                        n = Math.floor(0.1 * i * e),
                        r = CacheDataManager.getLvUpgradeValueData(p.UpgradeData.offLineAddtion),
                        s = CacheDataManager.mulDot(t, n * r);
                    this.addCost = s;
                    for (; "0" != this.addCost && "0" == this.addCost[0];)
                        this.addCost = this.addCost.substring(1, this.addCost.length);
                    if ("0" != this.addCost && "00" != this.addCost) {
                        var c = Math.floor(i / 60),
                            l = "" + Math.floor(c / 60),
                            d = "" + (c % 60);
                        this._detail1.$Label.string = "+" + ParseTool.parseAbc(s);
                        this._curTime.$Label.string = l + "h " + d + "m";
                        this._progress.$ProgressBar.progress = i / a;
                    } else this.closeUI();
                };
                e.prototype.onCloseStart = function () {
                    if (GameDataValue.getNewInvate()) {
                        GameDataValue.resetNewInvate();
                        c.default.open(s.UIID.UIInvateZhuanshi);
                    }
                };
                e.prototype._onCloseTouchEnd = function () {
                    var t = this.addCost;
                    if ("0" == t || "00" == t) this.closeUI();
                    else {
                        EVUIEffView.emit(
                            EVUIEffView.moveCoin,
                            this._detail1.convertToWorldSpaceAR(cc.Vec2.ZERO),
                            3,
                            t,
                            "0"
                        );
                        this.closeUI();
                    }
                };
                e.prototype._onViewADTouchEnd = function () {
                    var t = this,
                        e = CacheDataManager.mulCost(this.addCost, "2");
                    BannerAd.Instance.ShowVideo(() => {
                        QReport.send("2005");
                        EVUIEffView.emit(
                            EVUIEffView.moveCoin,
                            t._detail1.convertToWorldSpaceAR(cc.Vec2.ZERO),
                            3,
                            e,
                            "0"
                        );
                        t.closeUI();
                    });
                    // AdView.showRewardVedioAd(
                    //     function (o) {
                    //         if (o) {
                    //             QReport.send("2005");
                    //             EVUIEffView.emit(
                    //                 EVUIEffView.moveCoin,
                    //                 t._detail1.convertToWorldSpaceAR(cc.Vec2.ZERO),
                    //                 3,
                    //                 e,
                    //                 "0"
                    //             );
                    //             t.closeUI();
                    //         }
                    //     },
                    //     "4",
                    //     "offline"
                    // );
                };
                return n([d], e);
            })(r.default));
o.default = u;
